<template>
  <div>
    <ant-modal
      modalWidth="1200"
      modalHeight="950"
      :visible="open"
      :modal-title="formTitle"
      :adjust-size="true"
      @cancel="cancel"
    >
      <a-form-model
        ref="form"
        :model="form"
        :rules="rules"
        slot="content"
        layout="vertical"
      >
        <a-row
          :gutter="32"
          style="width: 50%; margin-left: 28%; margin-top: -10px"
        >
          <a-col :span="24" style="margin-left: -120px; margin-bottom: 15px">
            <div style="display: flex; flex-direction: row">
              <span
                style="
                  width: 5px;
                  height: 22px;
                  background-color: coral;
                  display: block;
                "
              ></span>
              <span
                style="
                  margin-left: 5px;
                  height: 22px;
                  line-height: 22px;
                  font-size: 16px;
                  font-weight: 600;
                "
                >用户进件预审</span
              >
            </div>
          </a-col>

          <a-col :span="12">
            <a-form-model-item label="服务机构" prop="orgType">
              <a-select
                placeholder="请选择服务机构"
                v-model="form.orgType"
                :getPopupContainer="
                  (triggerNode) => {
                    return triggerNode.parentNode || document.body;
                  }
                "
                style="width: 100%"
                allow-clear
                @change="handleGetProductInfo"
              >
                <a-select-option
                  v-for="(d, index) in orgTypeOptions"
                  :key="index"
                  :value="d.dictValue"
                  >{{ d.dictLabel }}</a-select-option
                >
              </a-select>
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="产品名称" prop="productId">
              <a-select
                placeholder="请选择产品"
                v-model="form.productId"
                :getPopupContainer="
                  (triggerNode) => {
                    return triggerNode.parentNode || document.body;
                  }
                "
                style="width: 100%"
                allow-clear
                @select="handleChooseProduct"
              >
                <a-select-option
                  v-for="d in productList"
                  :key="d.productName"
                  :value="d.id"
                  >{{ d.productName }}</a-select-option
                >
              </a-select>
            </a-form-model-item>
          </a-col>

          <a-col :span="12">
            <a-form-model-item label="客户姓名" prop="customerName">
              <a-input
                v-model="form.customerName"
                placeholder="请选择客户"
                disabled
                @search="handleOnSearchCustomer"
                style="width: 70%"
              >
              </a-input>
              <a-button
                type="primary"
                icon="setting"
                @click="handleOnSearchCustomer"
                style="margin-left: 5px"
              >
              </a-button>
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="身份证号码" prop="idCard">
              <a-input v-model="form.idCard" placeholder="自动获取" disabled />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="电话" prop="phone">
              <a-input v-model="form.phone" placeholder="请输入电话" />
            </a-form-model-item>
          </a-col>

          <a-col :span="12">
            <a-form-model-item label="意向额度（元）" prop="yxEdu">
              <a-input-number
                v-model="form.yxEdu"
                :min="0"
                style="width: 100%"
                placeholder="请输入意向额度（元）"
              />
            </a-form-model-item>
          </a-col>

          <a-col :span="12">
            <a-form-model-item label="还款方式" prop="backType">
              <a-select
                placeholder="请选择还款方式"
                v-model="form.backType"
                :getPopupContainer="
                  (triggerNode) => {
                    return triggerNode.parentNode || document.body;
                  }
                "
                style="width: 100%"
                allow-clear
              >
                <a-select-option
                  v-for="(d, index) in backTypeOptions"
                  :key="index"
                  :value="d.dictValue"
                  >{{ d.dictLabel }}</a-select-option
                >
              </a-select>
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="月供金额（元）" prop="monthAmount">
              <a-input-number
                v-model="form.monthAmount"
                :min="0"
                style="width: 100%"
                placeholder="请输入月供金额（元）"
              />
            </a-form-model-item>
          </a-col>

          <a-col :span="12">
            <a-form-model-item label="分期时间（月数）" prop="fenqiTime">
              <a-input-number
                v-model="form.fenqiTime"
                :min="0"
                style="width: 100%"
                placeholder="请输入分期时间（月数）"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="抵押时间（天数）" prop="diyaTime">
              <a-input v-model="form.diyaTime" placeholder="请输入抵押时间" />
            </a-form-model-item>
          </a-col>

          <a-col :span="12">
            <a-form-model-item label="签单时间" prop="qiandanTime">
              <a-date-picker
                v-model="form.qiandanTime"
                valueFormat="YYYY-MM-DD"
                :show-today="true"
                placeholder="选择日期"
                style="width: 100%"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="客服" prop="servcieUserName">
              <a-input
                v-model="form.servcieUserName"
                placeholder="请选择客服"
                disabled
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="服务费" prop="serviceAmount">
              <a-input-number
                v-model="form.serviceAmount"
                :min="0"
                style="width: 100%"
                placeholder="请输入服务费"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="费用备注" prop="serviceAmountRemark">
              <a-input
                type="textarea"
                v-model="form.serviceAmountRemark"
                placeholder="请输入费用备注"
              />
            </a-form-model-item>
          </a-col>
        </a-row>
      </a-form-model>
      <template slot="footer">
        <a-button @click="cancel"> 取消 </a-button>
        <a-button type="primary" @click="submitForm"> 保存 </a-button>
      </template>
    </ant-modal>
    <a-modal
      :visible="visibleShowUser"
      title="选择客户"
      v-if="visibleShowUser"
      @cancel="visibleShowUser = false"
      @ok="visibleShowUser = false"
      width="900px"
      :dialog-style="{ top: '20px', heigth: '800px' }"
    >
      <a-card :bordered="false" class="table-card">
        <user-list @getCustomer="getCustomerInfo"></user-list>
      </a-card>
    </a-modal>
  </div>
</template>
<script>
import BizJinjianInfoAddForm from "./BizJinjianInfoForm";
export default {
  ...BizJinjianInfoAddForm,
};
</script>
